<!--
 * @Description: 
 * @version: 
 * @Author: 尹鹏孝
 * @Date: 2022-02-07 16:07:01
 * @LastEditors: 尹鹏孝
 * @LastEditTime: 2022-02-07 16:39:01
-->
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>字符串反转</title>
</head>

<body>
    <script>
        var reverseString = function (s) {
            let k = s;
            let m = s.length;
            let d = '';
            for (let i = 0; i < k.length; i++) {
                if (m > -1) {
                    d += s[--m];
                }
            }
            return d;
        };
        console.log(reverseString('开工大吉!'));
    </script>
</body>

</html>